import { post } from '../http'
import { cherryPick2Dict } from '@/utils/formatResponseData'

export const carManageDict = () =>
  post({
    url: '/carInfo/toList',
    format: (res) =>
      cherryPick2Dict(res.result, {
        fuelOiltype: 'fuelOiltype',
        carTypeList: 'carTypeList',
        dictDtoList: 'dictDtoList',
        sourceEnumList: 'sourceEnumList',
        statusList: 'statusList',
        operateStatusList: 'operateStatusList',
        operateActiveStatusList: 'operateActiveStatusList',
        bussPropertyList: 'bussPropertyListV1',
        sitesByUser: 'sitesByUser',
        tagStatusEnums: 'tagStatusEnums',
        carLabelEnum: 'carLabelEnum',
        useInstallmentList: 'useInstallmentList',
        carUseNatureList: 'carUseNatureList',
        etcWorkStatusList: 'etcWorkStatusList',
        tboxEquipmentStatusList: 'tboxEquipmentStatusList',
        disposalSourceEnumList: 'disposalSourceEnumList',
        businessTypeList: 'businessTypeList',
        eventList: 'eventList',
        etcSourceEnums: 'etcSourceEnums',
        feeStatusEnum: 'feeStatusEnum',
        qrCodeLinkTypeEnums: 'qrCodeLinkTypeEnums',
      }),
  })

// 车型管理
export const carModelDict = () =>
  post({
    url: '/carModelTenant/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        modelTypeMap: 'modelTypeMap',
        fuelOiltypeMap: 'fuelOiltypeMap',
        gearboxTypeMap: 'gearboxTypeMap',
        carConfigMap: 'carConfigMap',
        yearStyleMap: 'yearStyleMap',
        modelSortMap: 'modelSortMap',
      }),
  })

// 门店管理
export const carsiteDict = () =>
  post({
    url: '/siteLease/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        siteStatus: 'siteStatus',
        rentSiteSelfAppStatus: 'rentSiteSelfAppStatus',
        siteConfigMap: 'siteConfigMap',
        nightServiceFeeMap: 'nightServiceFeeMap',
        hourAmountTypeMap: 'hourAmountTypeMap',
        onsiteServiceMap: 'onsiteServiceMap',
        onsiteServiceFeeMap: 'onsiteServiceFeeMap',
        onsiteMaxRadiusMap: 'onsiteMaxRadiusMap',
        diffSiteReturnMap: 'diffSiteReturnMap',
        diffSiteFeeMap: 'diffSiteFeeMap',
        diffSiteReturnCarMap: 'diffSiteReturnCarMap',
        diffCityReturnMap: 'diffCityReturnMap',
        diffCityFeeMap: 'diffCityFeeMap',
        diffCityReturnCarMap: 'diffCityReturnCarMap',
        overTimeFeeMap: 'overTimeFeeMap',
        overMilesFeeMap: 'overMilesFeeMap',
        enableSiteCancelMap: 'enableSiteCancelMap',
        cancelWeekdayBeforeRuleMap: 'cancelWeekdayBeforeRuleMap',
      }),
  })
// 组织 员工
export const staffDict = () =>
  post({
    url: '/staff/pageData',
    format: (res) =>
      cherryPick2Dict(res.result, {
        staffStatusList: 'staffStatusList',
        inExpWayList: 'inExpWayList',
      }),
  })

// 商户信息
export const enterpriseDict = () =>
  post({
    url: '/enterprise/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        settleChannel: 'settleChannel',
        epCate: 'epCate',
        enterpriseWxNativePayEnum: 'enterpriseWxNativePayEnum',
        businessTypeEnum: 'businessTypeEnum',
        serviceTypeEnum: 'serviceTypeEnum',
        shortRentChannelEnum: 'shortRentChannelEnum',
        enterprisePrepareStatusEnum: 'enterprisePrepareStatusEnum',
      }),
  })

// 保险信息
export const carInsuranceDict = () =>
  post({
    url: '/carInsurance/pageData',
    format: (res) =>
      cherryPick2Dict(res.result, {
        insureKindList: 'insureKindList',
        insureStatusList: 'insureStatusList',
        insureTypeList: 'insureTypeList',
        insureWarnList: 'insureWarnList',
        operateStatusList: 'operateStatusList',
      }),
  })
// 运维 保养状态
export const operationDict = () =>
  post({
    url: '/carMaintenance/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        maintenanceStatusEnum: 'maintenanceStatusEnum',
      }),
  })
// 运维 维修状态
export const repairDict = () =>
  post({
    url: '/repair/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        allStatusMap: 'allStatusMap',
      }),
  })
// 运维 违章信息
export const carviolationDict = () =>
  post({
    url: '/violation/getEnums',
    format: (res) => {
      res.result.violationLabelEnum.forEach((item) => {
        item.value = item.name
      })

      return cherryPick2Dict(res.result, {
        violationHandleEnum: 'violationHandleEnum',
        ViolationEventStatusEnum: 'ViolationEventStatusEnum',
        violationDepositTypeEnum: 'violationDepositTypeEnum',
        urgePayStatus: 'urgePayStatus',
        feeStatus: 'feeStatus',
        violationFeeStateEnum: 'violationFeeStateEnum',
        violationPartyEnum: 'violationPartyEnum',
        inExpWayList: 'inExpWayList',
        violationLabelEnum: 'violationLabelEnum',
        queryRecordStatus: 'queryRecordStatus', // 查询记录状态枚举
        violationQueryStatusEnum: 'violationQueryStatusEnum', // 违章查询状态
      })
    },
  })
// 设备 车机
export const vehicleDict = () =>
  post({
    url: '/carVehicle/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        vehicleFirmMap: 'vehicleFirmMap', //设备品牌
        equipmentTypeMap: 'equipmentTypeMap', //设备类型
        vehicleStatusMap: 'vehicleStatusMap', //设备状态
        handleTypeMap: 'handleTypeMap', //处置方式
        carVehicleOnLineStateMap: 'carVehicleOnLineStateMap', //车机设备在线状态
        vehicleUrlMap: 'vehicleUrlMap', //GPS外链
      }),
  })
export const carInspectDict = () =>
  post({
    url: '/inspection/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        inspectionStatus: 'inspectionStatus', //年检状态
        settlementStatusMap: 'settlementStatusMap', //结算状态
        payWayMap: 'payWayMap', //短租结算 - 付款方式
        recordPayReasonMap: 'recordPayReasonMap', //短租订单 - 付款原因
      }),
  })
//借调
export const carTransferDict = () =>
  post({
    url: '/carSeconded/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        statusEnum: 'statusEnum', //状态
        typeEnum: 'typeEnum', //借调类型
        sourceTypeEnum: 'sourceTypeEnum', //来源类型
        costTypeEnum: 'costTypeEnum', //收支类型
        installmentEnum: 'installmentEnum', // 是否分期
      }),
  })

// 车辆信息同步
export const carSyncHrhcDict = () =>
  post({
    url: '/carSync/hrhc/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        carSyncStatusEnum: 'carSyncStatusEnum', // 车辆同步状态
        licenseNoColorList: 'licenseNoColorList', // 车牌颜色
        etcSourceEnums: 'etcSourceEnums',
        driverCarTypeList: 'driverCarTypeList',
      }),
  })

// 车载box
export const carTboxVehicleDict = () =>
  post({
    url: '/carTboxVehicle/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        vehicleStatusEnums: 'vehicleStatusEnums', // 设备状态
        vehicleFirmEnums: 'vehicleFirmEnums', // 设备供应商
        licenseNoColorEnums: 'licenseNoColorEnums', // 车牌颜色
      }),
  })

// 虚拟钥匙控车单
export const carVirtualDict = () =>
  post({
    url: '/carControl/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        statusEnums: 'statusEnums', // 控车单状态
        refTypeEnums: 'refTypeEnums', // 相关单据类型
      }),
  })

// 车辆库存
export const carStockDict = () =>
  post({
    url: '/carStock/getEnums',
    format: (res) =>
      cherryPick2Dict(res.result, {
        channelTypeEnum: 'channelTypeEnum', // 渠道
      }),
  })
